<!DOCTYPE>
<html xmlns:th="http://www.thymeleaf.org" style="height: 100%">
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" media="all">
    <script th:src="@{/layui/layui.js}" charset="utf-8"></script>
    <script th:src="@{/echarts/echarts.min.js}" charset="utf-8"></script>
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>

<!--<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>-->
<!-- Uncomment this line if you want to dataTool extension
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/extension/dataTool.min.js"></script>
-->
<!-- Uncomment this line if you want to use gl extension
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
-->
<!-- Uncomment this line if you want to echarts-stat extension
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
-->
<!-- Uncomment this line if you want to use map
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/map/js/china.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/map/js/world.js"></script>
-->
<!-- Uncomment these two lines if you want to use bmap extension
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=<Your Key Here>"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/extension/bmap.min.js"></script>
-->

<script type="text/javascript">
    var dom = document.getElementById("container");
    var myChart = echarts.init(dom);
    var app = {};

    var option;


    layui.use('layer',function (){
        var $ = layui.jquery;
        //获取各地人数数据
        $.ajax({
            url:"/dataanalysis/riseCount",
            success:function (respData){
                //把json数据转化为数组

                //声明日期和收入的2个数组
                var date = [];
                var total = [];

                for (var i=0;i<respData.length;i++){
                    date[i] = respData[i].date;
                    total[i] = respData[i].total;
                }
                option = {
                    title:{
                        text:'每日入库物资',
                        top: 20,
                        left:'center',
                        textStyle:{
                            fontSize:30,

                        }
                    },
                    xAxis: {
                        type: 'category',
                        data: date
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [{
                        data: total,
                        type: 'line'
                    }]
                };

                if (option && typeof option === 'object') {
                    myChart.setOption(option);
                }

            }
        })
    })

</script>
</body>
</html>